package com.vallis.lotteryonline.exception;




import com.vallis.lotteryonline.util.Result;

import java.text.MessageFormat;

/**
 * 自定义异常类型
 * @author pyy
 **/
public class CustomException extends RuntimeException {

    //错误代码
    Result result;

    public CustomException(Result result){
        super(result.getMsg());
        this.result = result;
    }

    public CustomException(Result result, Object... args){
        super(result.getMsg());
        String message = MessageFormat.format(result.getMsg(), args);
        result.setMsg(message);
        this.result = result;
    }

    public Result getResult(){
        return result;
    }

}
